Skip to content

test: add unit tests for eye protection, restore tip and view state - #353

Merged
pengfeixx merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:master
Sep 1, 2026
Merged

test: add unit tests for eye protection, restore tip and view state#353
pengfeixx merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:master

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Add new test suites for EyeProtectionManager/EyeProtectionAction and RestoreTipWidget; extend Database, DocSheet, sidebar and browser tests to cover tab group persistence, view state restore and theme lambdas.

新增护眼管理、恢复提示控件测试套件;补充数据库标签组持久化、
文档状态恢复、目录展开及主题切换 lambda 等测试用例。

Log: 补充单元测试用例
Influence: 仅新增/修改测试代码,不影响功能逻辑,提升测试覆盖率。

Summary by Sourcery

Increase unit-test coverage for eye protection, restore-tip behavior, persisted tab groups, and document view-state restoration.

Enhancements:

  • Expand unit-test coverage for database tab-group persistence and orphan-state cleanup.
  • Cover document view-state saving and restoration, active-file selection, pending tabs, sidebar expansion and sizing, scrolling, and restore-tip interactions.
  • Add dedicated tests for eye-protection management/actions, restore-tip widgets, and related UI event handling.
  • Exercise browser image processing, document identifiers, catalog restoration, theme changes, and other UI lambdas and edge cases.

Tests:

  • Add unit-test suites for EyeProtectionManager/EyeProtectionAction and RestoreTipWidget, while extending coverage across database, document, browser, sidebar, and UI-frame components.

@sourcery-ai

sourcery-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds test-only coverage for eye protection, restore-tip interactions, tab-group persistence, document/view-state restoration, sidebar expansion, theme/night-mode callbacks, and related UI branches; also fixes a renderer test fixture so its callback path is actually exercised.

File-Level Changes

Change Details Files
Added focused unit coverage for eye-protection management/actions and restore-tip widget behavior.
  • Verified color validity, mode changes, duplicate-mode early return, and action callbacks.
  • Exercised restore-tip visibility, painting, resizing, font updates, and jump/close signals.
tests/eyeprotection/ut_eyeprotection.cpp
tests/widgets/ut_restoretipwidget.cpp
tests/widgets/ut_roundcolorwidget.cpp
Expanded persistence and document/view-state tests across database, document sheets, tabs, and central UI.
  • Covered tab-group creation, replacement, reading, clearing, and orphan-state cleanup.
  • Exercised view-state save/restore, scroll position, sidebar width, splitter handling, active-file selection, and restore-tip signal paths.
  • Added file-identifier and pending/initial active-file cases.
tests/app/ut_database.cpp
tests/document/ut_djvumodel.cpp
tests/document/ut_pdfmodel.cpp
tests/uiframe/ut_central.cpp
tests/uiframe/ut_centraldocpage.cpp
tests/uiframe/ut_docsheet.cpp
tests/uiframe/ut_doctabbar.cpp
tests/ut_mainwindow.cpp
Added sidebar and browser coverage for state restoration and UI/theme-related callbacks.
  • Tested catalog expanded-section capture/restoration and empty-input paths.
  • Triggered theme-change and eye-protection lambdas, plus browser night-mode and scroll restoration branches.
tests/sidebar/ut_catalogtreeview.cpp
tests/sidebar/ut_catalogwidget.cpp
tests/sidebar/ut_sheetsidebar.cpp
tests/sidebar/ut_sidebarimagelistview.cpp
tests/browser/ut_browserpage.cpp
tests/browser/ut_sheetbrowser.cpp
Corrected the page-render thread test setup to exercise the live-renderer callback path.
  • Constructed and supplied a SheetRenderer so the document-open task reaches handleOpened.
tests/browser/ut_pagerenderthread.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Add new test suites for EyeProtectionManager/EyeProtectionAction and
RestoreTipWidget; extend Database, DocSheet, sidebar and browser tests
to cover tab group persistence, view state restore and theme lambdas.

新增护眼管理、恢复提示控件测试套件;补充数据库标签组持久化、
文档状态恢复、目录展开及主题切换 lambda 等测试用例。

Log: 补充单元测试用例
Influence: 仅新增/修改测试代码,不影响功能逻辑,提升测试覆盖率。
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, pengfeixx

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pengfeixx
pengfeixx merged commit 5232d07 into linuxdeepin:master Sep 1, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants